Skip to content

Conversation

@Tarquinen
Copy link
Collaborator

Summary

  • Fix case-sensitive tool ID comparison that could cause re-processing of already pruned tools when IDs appeared with different casing from different providers
  • Improve lookup performance by using a Set with O(1) lookups instead of O(n) array includes() calls

Details

The pruning logic in janitor.ts was using case-sensitive includes() checks to determine if a tool call ID had already been pruned. This could fail if the same tool call ID was received with different casing (e.g., from different API providers), causing unnecessary re-processing.

This fix normalizes all IDs to lowercase before comparison and uses a Set for efficient lookups.

Previously, tool call IDs were compared using case-sensitive includes() checks,
which could cause re-processing of already pruned tools if the same ID appeared
with different casing from different providers.

This change normalizes IDs to lowercase before comparison using a Set for
efficient O(1) lookups instead of O(n) array includes() calls.
@Tarquinen Tarquinen merged commit 42f3116 into master Dec 11, 2025
1 check passed
@Tarquinen Tarquinen deleted the fix/case-insensitive-tool-id-matching branch December 11, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants